package com.haiertvbic.tvwa.util;

import android.app.Activity;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.LinearLayout.LayoutParams;
import android.widget.TextView;
import android.widget.Toast;

import com.haiertvbic.tvwa.R;

public class LocateToast {
	
	public static void locateToast(Activity context ,int width ,String content){
		LayoutInflater inflater = LayoutInflater.from(context);
		View toastView = inflater.inflate(R.layout.toast_layout, null);
		TextView contentView = (TextView) toastView.findViewById(R.id.content);
		contentView.setLayoutParams(new LayoutParams(width ,LayoutParams.WRAP_CONTENT));
		contentView.setText(content);
		
		int disWidth = context.getWindowManager().getDefaultDisplay().getWidth();
		
		Toast toast = new Toast(context);
		toast.setView(toastView);
		toast.setGravity(Gravity.BOTTOM|Gravity.RIGHT, (disWidth/8 - width/2), 50);
		toast.setDuration(1);
		toast.show();
		
		
	}

}
